package org.eden.karb.persistence.dao.impl;

import org.eden.karb.persistence.dao.SessionDAO;
import org.eden.karb.persistence.entity.Session;

import javax.persistence.Query;

/**
 * @author trsimoes
 */
public class SessionDAOImpl extends AbstractDAOImpl<Session> implements SessionDAO {

    public Session findByKey(String sessionKey) {

        Query query = entityManager.createQuery("SELECT session FROM Session session WHERE session.key = :key");
        query.setParameter("key", sessionKey);

        return (Session) query.getSingleResult();
    }
}
